package com.example.library_common.album.view.editor_img.view;

import android.view.GestureDetector;
import android.view.MotionEvent;

class MoveAdapter extends GestureDetector.SimpleOnGestureListener {

    private OnScrollListener onScroll;

    public MoveAdapter(OnScrollListener onScroll) {
        this.onScroll = onScroll;
    }

    @Override
    public boolean onDown(MotionEvent e) {
        return true;
    }

    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        if (onScroll!=null){
           return onScroll.onScroll(distanceX,distanceY);
        }
        return super.onScroll(e1,e2,distanceX,distanceY);
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        // TODO
        return super.onFling(e1, e2, velocityX, velocityY);
    }

    public interface OnScrollListener{
        boolean onScroll(float distanceX, float distanceY);
    }
}